# @algorithm @lc id=100274 lang=python3 
# @title fei-bo-na-qi-shu-lie-lcof


from cn.Python3.mod.preImport import *
class Solution:
# @test(0)=0
    def fib(self, n: int) -> int:
        mod = 10**9+7
        prev, ans = 0, 1
        if not n:
            return 0
        for i in range(1, n):
            prev, ans = ans, (ans+prev)%mod
        return ans